<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------
namespace addon\mall\logic;
use app\common\logic\LogicBase;
use \tpfcore\Core;

class GoodsComment extends LogicBase
{
	public function getGoodsComment($data=[]){
		return Core::loadAddonModel($this->name)->getList($data);
	}
	public function saveGoodsComment($data){
		$validate=Core::addonValidate($this->name);
        $validate_result = $validate->scene("add")->check($data);
        if (!$validate_result) {
            return [RESULT_ERROR, $validate->getError(), null];
        }
        $result = Core::loadAddonModel($this->name)->saveObject($data);
		if($result){
			return [RESULT_SUCCESS,"操作成功",url('mall/GoodsComment/index')];
		}
		return [RESULT_ERROR,"操作失败"]; 
	}
	public function delGoodsComment($data){
		$result = self::deleteObject($data,true);
		if($result){
			return [RESULT_SUCCESS,"操作成功",url('mall/GoodsComment/index')];
		}
		return [RESULT_ERROR,"操作失败"]; 
	}	
}